import time
import threading
sum = 0
num = 1000000
def add():
    global sum,num
    for i in range(0,num):
        sum += i
def miue():
    global sum,num
    for i in range(0,num):
        sum -= i
print('start sum is {}'.format(sum))
t1 = threading.Thread(target=add,args=())
t2 = threading.Thread(target=miue,args=())
t1.start()
t2.start()
t1.join()
t2.join()
print('end sum is {}'.format(sum))
